package cn.kgc.base.service.impl;

import cn.kgc.base.entity.SysDictItem;
import cn.kgc.base.service.SysDictItemService;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import cn.kgc.base.mapper.SysDictMapper;
import cn.kgc.base.entity.SysDict;
import cn.kgc.base.service.SysDictService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

/**
 * (SysDict)表服务实现类
 *
 * @author 石浩杰
 * @since 2022-11-30 14:50:39
 */
@Service("sysDictService")
public class SysDictServiceImpl extends ServiceImpl<SysDictMapper, SysDict> implements SysDictService {

    @Resource
    private SysDictMapper sysDictMapper;
    @Resource
    private SysDictItemService sysDictItemService;
    @Override
    public boolean deleteById(Long id) {
        sysDictMapper.deleteById(id);
        LambdaQueryWrapper<SysDictItem> queryWrapper = new LambdaQueryWrapper<>();
        queryWrapper.eq(SysDictItem::getDictId, id);
        sysDictItemService.remove(queryWrapper);
        return true;
    }
}
